package com.openatc.agent.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.openatc.model.model.ControlPattern;
import com.openatc.model.model.MyGeometry;
import com.vladmihalcea.hibernate.type.json.JsonBinaryType;
import lombok.Data;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;

import javax.persistence.*;

@Data
@Table(name = "vip_route_device")
@Entity
@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class)
@JsonIgnoreProperties(ignoreUnknown = true)
public class VipRouteDevice {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;

    private int viprouteid;

    private String agentid;

    private String name;

    @Transient
    private MyGeometry geometry;

    private String geometryStr;

    @Type(type = "jsonb")
    @Column(columnDefinition = "jsonb")
    private ControlPattern data;

    @Transient
    private int state;

    @Transient
    private String resttime;

    @Transient
    private int currentControl;

    @Transient
    private String stateName;
}
